﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UtilLib
{
    /// <summary>
    /// 扩展
    /// </summary>
    public static partial class Util
    {
        /// <summary>
        /// 向上取整
        /// </summary>
        /// <param name="v"></param>
        /// <returns></returns>
        public static int IntCeiling(this double v)
        {
            return (int)(Math.Ceiling(v));
        }
        /// <summary>
        /// 向上取整
        /// </summary>
        /// <param name="v"></param>
        /// <returns></returns>
        public static int IntCeiling(this float v)
        {
            return (int)(Math.Ceiling(v));
        }
        /// <summary>
        /// 向上取整
        /// </summary>
        /// <param name="v"></param>
        /// <returns></returns>
        public static long LongCeiling(this double v)
        {
            return (long)(Math.Ceiling(v));
        }
        /// <summary>
        /// 向上取整
        /// </summary>
        /// <param name="v"></param>
        /// <returns></returns>
        public static long LongCeiling(this float v)
        {
            return (long)(Math.Ceiling(v));
        }

        /// <summary>
        /// 向下取整
        /// </summary>
        /// <param name="v"></param>
        /// <returns></returns>
        public static int IntFloor(this double v)
        {
            return (int)(Math.Floor(v));
        }
        /// <summary>
        /// 向下取整
        /// </summary>
        /// <param name="v"></param>
        /// <returns></returns>
        public static int IntFloor(this float v)
        {
            return (int)(Math.Floor(v));
        }
        /// <summary>
        /// 向下取整
        /// </summary>
        /// <param name="v"></param>
        /// <returns></returns>
        public static long LongFloor(this double v)
        {
            return (long)(Math.Floor(v));
        }
        /// <summary>
        /// 向下取整
        /// </summary>
        /// <param name="v"></param>
        /// <returns></returns>
        public static long LongFloor(this float v)
        {
            return (long)(Math.Floor(v));
        }
    }
}
